home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / axcool / axcool.ctl < prev    next >
Text File  |  1998-10-27  |  16KB  |  437 lines

  1. VERSION 5.00
  2. Begin VB.UserControl axCool 
  3.    Alignable       =   -1  'True
  4.    CanGetFocus     =   0   'False
  5.    ClientHeight    =   450
  6.    ClientLeft      =   0
  7.    ClientTop       =   0
  8.    ClientWidth     =   6435
  9.    MaskColor       =   &H00C0C0C0&
  10.    PropertyPages   =   "axCool.ctx":0000
  11.    ScaleHeight     =   30
  12.    ScaleMode       =   3  'Pixel
  13.    ScaleWidth      =   429
  14.    ToolboxBitmap   =   "axCool.ctx":0010
  15.    Begin axCoolbar.axCoolButton btnCool 
  16.       Height          =   330
  17.       Index           =   1
  18.       Left            =   45
  19.       TabIndex        =   0
  20.       ToolTipText     =   "Button1"
  21.       Top             =   45
  22.       Visible         =   0   'False
  23.       Width           =   330
  24.       _ExtentX        =   582
  25.       _ExtentY        =   582
  26.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  27.          Name            =   "MS Sans Serif"
  28.          Size            =   8.25
  29.          Charset         =   0
  30.          Weight          =   400
  31.          Underline       =   0   'False
  32.          Italic          =   0   'False
  33.          Strikethrough   =   0   'False
  34.       EndProperty
  35.       MaskColor       =   -2147483633
  36.    End
  37. End
  38. Attribute VB_Name = "axCool"
  39. Attribute VB_GlobalNameSpace = False
  40. Attribute VB_Creatable = True
  41. Attribute VB_PredeclaredId = False
  42. Attribute VB_Exposed = True
  43. Attribute VB_Ext_KEY = "PropPageWizardRun" ,"Yes"
  44. Option Explicit
  45.  
  46. 'Default Property Values:
  47. Const m_def_BorderStyle = 2
  48.  
  49. 'Property Variables:
  50. Private m_BorderStyle As Integer
  51. Private mNodes As New CollectionEx
  52. Private bShowFlatGrey As Boolean
  53. Private bTextLabels As Boolean
  54.  
  55. Public Enum AxBorderStyles
  56.     [No Border] = 0
  57.     [Single] = 1
  58.     [Thin Raised] = 2
  59.     [Thick Raised] = 3
  60.     [Thin Inset] = 4
  61.     [Thick Inset] = 5
  62.     [Etched] = 6
  63.     [Bump] = 7
  64. End Enum
  65.  
  66. 'Event Declarations:
  67. Event Click(Index As Integer)
  68. Attribute Click.VB_Description = "Occurs when the button is pushed"
  69. Event DropDownClick(Index As Integer)
  70. Attribute DropDownClick.VB_Description = "Occurs when the dropdown button is clicked"
  71.  
  72.  
  73.  
  74. Private Sub btnCool_Click(Index As Integer)
  75.   RaiseEvent Click(Index)
  76. End Sub
  77.  
  78. Private Sub btnCool_DropDownClick(Index As Integer)
  79.   RaiseEvent DropDownClick(Index)
  80. End Sub
  81.  
  82. 'Initialize Properties for User Control
  83. Private Sub UserControl_InitProperties()
  84.     m_BorderStyle = m_def_BorderStyle
  85.     bShowFlatGrey = False
  86.     bTextLabels = False
  87.     UserControl.Height = 400
  88.     UserControl.Width = 6435
  89. End Sub
  90.  
  91. Private Sub UserControl_Paint()
  92.     Dim di As Long
  93.     Dim rc As RECT
  94.     
  95.     'draw outside border
  96.         
  97.     Select Case m_BorderStyle
  98.         Case [No Border]
  99.         
  100.         Case [Single]
  101.             di = GetClientRect(UserControl.hwnd, rc)
  102.             di = DrawEdge(UserControl.hdc, rc, BDR_RAISEDOUTER, BF_RECT Or BF_MONO)
  103.         
  104.         Case [Thin Raised]
  105.             di = GetClientRect(UserControl.hwnd, rc)
  106.             di = DrawEdge(UserControl.hdc, rc, BDR_RAISEDINNER, BF_TOPLEFT)
  107.             di = DrawEdge(UserControl.hdc, rc, BDR_RAISEDOUTER, BF_BOTTOMRIGHT)
  108.         
  109.         Case [Thick Raised]
  110.             di = GetClientRect(UserControl.hwnd, rc)
  111.             di = DrawEdge(UserControl.hdc, rc, EDGE_RAISED, BF_TOPLEFT)
  112.             di = DrawEdge(UserControl.hdc, rc, EDGE_RAISED, BF_BOTTOMRIGHT)
  113.     
  114.         Case [Thin Inset]
  115.             di = GetClientRect(UserControl.hwnd, rc)
  116.             di = DrawEdge(UserControl.hdc, rc, BDR_SUNKENINNER, BF_TOPLEFT)
  117.             di = DrawEdge(UserControl.hdc, rc, BDR_SUNKENOUTER, BF_BOTTOMRIGHT)
  118.         
  119.         Case [Thick Inset]
  120.             di = GetClientRect(UserControl.hwnd, rc)
  121.             di = DrawEdge(UserControl.hdc, rc, EDGE_SUNKEN, BF_TOPLEFT)
  122.             di = DrawEdge(UserControl.hdc, rc, EDGE_SUNKEN, BF_BOTTOMRIGHT)
  123.         
  124.         Case [Etched]
  125.             di = GetClientRect(UserControl.hwnd, rc)
  126.             di = DrawEdge(UserControl.hdc, rc, EDGE_ETCHED, BF_TOPLEFT)
  127.             di = DrawEdge(UserControl.hdc, rc, EDGE_ETCHED, BF_BOTTOMRIGHT)
  128.     
  129.         Case [Bump]
  130.             di = GetClientRect(UserControl.hwnd, rc)
  131.             di = DrawEdge(UserControl.hdc, rc, EDGE_BUMP, BF_TOPLEFT)
  132.             di = DrawEdge(UserControl.hdc, rc, EDGE_BUMP, BF_BOTTOMRIGHT)
  133.             
  134.     End Select
  135.         
  136. End Sub
  137.  
  138. 'Load property values from storage
  139. Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
  140. Dim iTotCnt As Integer, Index As Integer
  141.  
  142.     UserControl.Enabled = PropBag.ReadProperty("Enabled", True)
  143.     m_BorderStyle = PropBag.ReadProperty("BorderStyle", m_def_BorderStyle)
  144.     bShowFlatGrey = PropBag.ReadProperty("ShowFlatGrey", False)
  145.     bTextLabels = PropBag.ReadProperty("TextLabels", False)
  146.         
  147.         iTotCnt = PropBag.ReadProperty("Count", 0)
  148.         'ReDim mOtlData(totcnt)
  149.         For Index = 1 To iTotCnt
  150.           AddItem
  151.           Set mNodes.Item(Index).Bitmap = PropBag.ReadProperty("List_1" & Index, Nothing)
  152.           mNodes.Item(Index).Caption = PropBag.ReadProperty("List_2" & Index, "")
  153.           mNodes.Item(Index).Enabled = PropBag.ReadProperty("List_3" & Index, 1)
  154.           mNodes.Item(Index).Style = PropBag.ReadProperty("List_4" & Index, 0)
  155.           mNodes.Item(Index).Tag = PropBag.ReadProperty("List_5" & Index, "")
  156.           mNodes.Item(Index).ToolTipText = PropBag.ReadProperty("List_6" & Index, "")
  157.           mNodes.Item(Index).Visible = PropBag.ReadProperty("List_7" & Index, 1)
  158.           mNodes.Item(Index).DropDown = PropBag.ReadProperty("List_8" & Index, 0)
  159.         Next
  160.         
  161.       ShowButtons
  162. End Sub
  163.  
  164. Private Sub UserControl_Resize()
  165.   If bTextLabels Then
  166.     UserControl.Height = 720
  167.   Else
  168.     UserControl.Height = 400
  169.   End If
  170.   UserControl.Cls
  171.   UserControl_Paint
  172. End Sub
  173.  
  174. 'Write property values to storage
  175. Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
  176.     Dim Index As Integer
  177.     Call PropBag.WriteProperty("Enabled", UserControl.Enabled, True)
  178.     Call PropBag.WriteProperty("BorderStyle", m_BorderStyle, m_def_BorderStyle)
  179.     Call PropBag.WriteProperty("ShowFlatGrey", bShowFlatGrey, False)
  180.     Call PropBag.WriteProperty("TextLabels", bTextLabels, False)
  181.     
  182.     Call PropBag.WriteProperty("Count", mNodes.Count, 0)
  183.     For Index = 1 To mNodes.Count
  184.       Call PropBag.WriteProperty("List_1" & Index, mNodes(Index).Bitmap)
  185.       Call PropBag.WriteProperty("List_2" & Index, mNodes(Index).Caption)
  186.       Call PropBag.WriteProperty("List_3" & Index, mNodes(Index).Enabled)
  187.       Call PropBag.WriteProperty("List_4" & Index, mNodes(Index).Style)
  188.       Call PropBag.WriteProperty("List_5" & Index, mNodes(Index).Tag)
  189.       Call PropBag.WriteProperty("List_6" & Index, mNodes(Index).ToolTipText)
  190.       Call PropBag.WriteProperty("List_7" & Index, mNodes(Index).Visible)
  191.       Call PropBag.WriteProperty("List_8" & Index, mNodes(Index).DropDown)
  192.     Next
  193.     
  194. End Sub
  195.  
  196. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  197. 'MappingInfo=UserControl,UserControl,-1,Enabled
  198. Public Property Get Enabled() As Boolean
  199. Attribute Enabled.VB_Description = "Returns/sets a value that determines whether an object can respond to user-generated events."
  200.     Enabled = UserControl.Enabled
  201. End Property
  202.  
  203. Public Property Let Enabled(ByVal New_Enabled As Boolean)
  204.     UserControl.Enabled() = New_Enabled
  205.     PropertyChanged "Enabled"
  206. End Property
  207.  
  208. Sub ShowAboutBox()
  209. Attribute ShowAboutBox.VB_Description = "Show About box"
  210. Attribute ShowAboutBox.VB_UserMemId = -552
  211.   frmAbout.Show vbModal
  212.   Unload frmAbout
  213.   Set frmAbout = Nothing
  214. End Sub
  215.  
  216. Public Property Get BorderStyle() As AxBorderStyles
  217. Attribute BorderStyle.VB_Description = "Returns/sets the border style for the control."
  218.     BorderStyle = m_BorderStyle
  219. End Property
  220.  
  221. Public Property Let BorderStyle(ByVal New_BorderStyle As AxBorderStyles)
  222.     If Not (m_BorderStyle = New_BorderStyle) Then
  223.         m_BorderStyle = New_BorderStyle
  224.         UserControl.Cls
  225.         UserControl_Paint
  226.     End If
  227.     PropertyChanged "BorderStyle"
  228. End Property
  229.  
  230. ''MappingInfo=UserControl,UserControl,-1,Ambient
  231. 'Pub